#include <my_header.h>

/* Usage: ./8_stderr filename */
int main(int argc, char *argv[]){                                  
    ARGS_CHECK(argc, 2);
    int fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC,
                  0666);
    ERROR_CHECK(fd, -1, "open");

    printf("开始输出\n");
    
    
    int fd_cp = dup2(fd, STDERR_FILENO);
    fprintf(stderr, "ERROR");


    close(fd);
    close(fd_cp);
    return 0;
}


